@import '../core/theming/palette';
@import '../core/theming/theming';
@import '../core/theming/check-duplicate-styles';
@import '../core/typography/typography-utils';
@import '../core/density/index';
@import './paginator-variables';

@mixin mat-paginator-color($config-or-theme) {
  $config: mat-get-color-config($config-or-theme);
  $foreground: map-get($config, foreground);
  $background: map-get($config, background);

  .mat-paginator {
    background: mat-color($background, 'card');
  }

  .mat-paginator,
  .mat-paginator-page-size .mat-select-trigger {
    color: mat-color($foreground, secondary-text);
  }

  .mat-paginator-decrement,
  .mat-paginator-increment {
    border-top: 2px solid mat-color($foreground, 'icon');
    border-right: 2px solid mat-color($foreground, 'icon');
  }

  .mat-paginator-first,
  .mat-paginator-last {
    border-top: 2px solid mat-color($foreground, 'icon');
  }

  .mat-icon-button[disabled] {
    .mat-paginator-decrement,
    .mat-paginator-increment,
    .mat-paginator-first,
    .mat-paginator-last {
      border-color: mat-color($foreground, 'disabled');
    }
  }
}

@mixin mat-paginator-typography($config-or-theme) {
  $config: mat-get-typography-config($config-or-theme);
  .mat-paginator,
  .mat-paginator-page-size .mat-select-trigger {
    font: {
      family: mat-font-family($config, caption);
      size: mat-font-size($config, caption);
    }
  }
}

@mixin _mat-paginator-density($config-or-theme) {
  $density-scale: mat-get-density-config($config-or-theme);
  $height: _mat-density-prop-value($mat-paginator-density-config, $density-scale, height);

  @include _mat-density-legacy-compatibility() {
    .mat-paginator-container {
      min-height: $height;
    }
  }
}

@mixin mat-paginator-theme($theme-or-color-config) {
  $theme: _mat-legacy-get-theme($theme-or-color-config);
  @include _mat-check-duplicate-theme-styles($theme, 'mat-paginator') {
    $color: mat-get-color-config($theme);
    $density: mat-get-density-config($theme);
    $typography: mat-get-typography-config($theme);

    @if $color != null {
      @include mat-paginator-color($color);
    }
    @if $density != null {
      @include _mat-paginator-density($density);
    }
    @if $typography != null {
      @include mat-paginator-typography($typography);
    }
  }
}
